package previous.Test_0302;

import java.util.Scanner;

/**
 * Created with Intellij IDEA
 * Description:
 * User: 星辰
 */
public class Blue_bridge {
    //求阶乘
    //求每个末尾0的个数
    //求最小末尾k个0的数；
    //超时
    public static void main1(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int k=scan.nextInt();
        long ret=1;
        for (long i = 1; i <=40; i++) {
            ret*=i;
            StringBuilder s=new StringBuilder();
            s.append(ret+"");
            int count=0;
            for (int j = s.length()-1; j >=0; j--) {
                if(s.charAt(j)=='0'){
                    count++;
                }else
                    break;
                }
            if(count==k){
                System.out.println(i);
                break;
            }

            }
        scan.close();
        }
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        long k=scan.nextLong();
        long left=1;
        long ret=-1;
        long right=5*k;
        while(left<=right){
            long mid=left+(right-left)/2;
            if(f(mid)>k){
                right=mid-1;
            }else if(f(mid)<k){
                left=mid+1;
            }else{
                //如果末尾0个数与k相等，但不一定是最小值所以还要寻找
                ret=mid;
                //继续向前寻找
                right=mid-1;

            }
        }
        //还要验证结果，可能k值太大，没有该结果
        System.out.println((ret!=-1 && f(ret)==k)? ret:-1);
        scan.close();
    }
    //求5的质因数个数
    public static long f(long i){
        long sum=0;
        while(i>0){
            sum+=i/5;
            i/=5;
        }
        return sum;
    }
}
